const http = require('http')

const request = require('request')

const async = require('async')

const util = require('util')

const _ = require('lodash')

const fs = require('fs')

function QingTingFm(chan,id) {
	this._chan = chan
	// this._id = id
}

QingTingFm.prototype = {
	crawl() {
		let url = this.getAjaxUrl()
		console.log(url)
		request(url,(err,res,body)=>{
			if(err==null&&res.statusCode==200){
				let data = JSON.parse(body)
				console.log(body)
			}else {
				console.error("下载数据失败")
				console.log(err)
				console.log(res.statusCode)
			}
		})

	},
	getAjaxUrl() {
		return util.format('http://www.qingting.fm/channels/%s', this._chan)
	}
}

var t1 = (new Date()).getTime()
qtfm = new QingTingFm(136962, 5745196)
qtfm.crawl()
